#ifndef PARSEDES_H_
#define PARSEDES_H_

#define SERVICE_NAME_LANGTH_MAX 512
#define STUFFING_BYTE_MAX 204

typedef struct NETWORK_NAME_DESCRIPTOR
{
	unsigned char descriptor_tag :8;
	unsigned char descriptor_length :8;
	unsigned char descriptor_char[STUFFING_BYTE_MAX];
}NETWORK_NAME_DESCRIPTOR;

typedef struct SERVICE_DESCRIPTOR
{
	unsigned char descriptor_tag :8;
	unsigned char descriptor_length :8;
	unsigned char service_type :8;
	unsigned char service_provider_name_length :8;
	unsigned char service_provider_name[SERVICE_NAME_LANGTH_MAX];
	unsigned char service_name_length :8;
	unsigned char service_name[SERVICE_NAME_LANGTH_MAX];
} SERVICE_DESCRIPTOR;

typedef struct STREAM_IDENTIFIER_DESCRIPTOR
{
	unsigned char descriptor_tag :8;
	unsigned char descriptor_length :8;
	unsigned char component_tag :8;
}STREAM_IDENTIFIER_DESCRIPTOR;

typedef struct STUFFING_DESCRIPTOR
{
	unsigned char descriptor_tag :8;
	unsigned char descriptor_length :8; 
	unsigned char stuffing_byte[STUFFING_BYTE_MAX];
}STUFFING_DESCRIPTOR;

typedef struct SERVICR_LIST_INFO
{
	unsigned int service_id :16;
	unsigned char service_type :8;
}SERVICR_LIST_INFO;


typedef struct SERVICR_LIST_DESCRIPTOR
{
	unsigned char descriptor_tag :8;
	unsigned char descriptor_length :8; 

	SERVICR_LIST_INFO service_info[STUFFING_BYTE_MAX];

}SERVICR_LIST_DESCRIPTOR;

typedef struct SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR
{
	unsigned char descriptor_tag :8;
	unsigned char descriptor_length :8;
	unsigned int frequency :32;
	unsigned int orbital_position	:16;
	unsigned char west_east_flag	:1;
	unsigned char polarization	:2;
	unsigned char roll_off	:2;
	unsigned char zero		:2;
	unsigned char modulation_system	:1;
	unsigned char moudulation_type	:2;
	unsigned int symbol_rate	:28;
	unsigned char FEC_inner	:4;
}SATELLITE_DELIVERY_SYSTEM_DESCRIPTOR;

typedef struct CABLE_DELIVERY_SYSTEM_DESCRIPTOR
{
	unsigned char descriptor_tag	:8;
	unsigned char descriptor_length	:8;
	unsigned int reserved_future_use	:12;
	unsigned int frequency	:32;
	unsigned char FEC_outer	:4;
	unsigned char modulationg	:8;
	unsigned int symbol_rate	:28;
	unsigned int FEC_inner	:32;
}CABLE_DELIVERY_SYSTEM_DESCRIPTOR;




void ParseTS_Descriptor(unsigned char Descriptor[204]);


#endif